<div class="modal fade " id="manageMailAddressModal"   role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="box box-info">
            <div class="box-header with-border">
                <h3 class="box-title">地址修改</h3>
            </div>
            <!-- /.box-header -->
            <!-- form start -->
            <form class="form-horizontal" id="addExchangeInfoForm">
                <div class="box-body">
                    <div class="form-group">
                        <input type="hidden" id="manangeid">
                        <label for="inputEmail3" class="col-sm-2 control-label">邮箱</label>
                        <div class="col-sm-7">
                            <input id="manangedestAddress" type="text" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label">抄送</label>
                        <div class="col-sm-7">
                            <textarea id="manangetoCcMails" type="text" class="form-control" rows="10">
                            </textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label">密送</label>
                        <div class="col-sm-7">
                            <textarea id="manangetoSeCcMails" type="text" class="form-control" rows="10">
                            </textarea>
                        </div>
                    </div>
                </div>
                <!-- /.box-body -->
                <div class="box-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal"  >取消</button>

                    <button type="button" class="btn btn-primary pull-right" onclick="save()">保存</button>
                </div>
                <!-- /.box-footer -->
            </form>
        </div>
    </div>
</div>
<script>
    function manageMailAddressModalInit(id,destAddress,toCcMails,toSeCcMails) {
        $("#manangeid").val("");
        $("#manangedestAddress").val("");
        $("#manangetoCcMails").val("");
        $("#manangetoSeCcMails").val("");
        // 赋值

        $("#manangeid").val(id);
        $("#manangedestAddress").val(destAddress);
        $("#manangetoCcMails").val(toCcMails);
        $("#manangetoSeCcMails").val(toSeCcMails);
    }
    function save() {
        var id = $("#manangeid").val();
        var destAddress = $("#manangedestAddress").val();
        var toCcMails = $("#manangetoCcMails").val();
        var toSeCcMails = $("#manangetoSeCcMails").val();
        if(destAddress == "" || destAddress == undefined ||destAddress == null) {
            toastr['error']('收件人必填', '提示');
        }
        var url = "/custservice/modifymails";
        var data = {
            id:id,
            destAddress:destAddress,
            toCcMails:toCcMails,
            toSeCcMails:toSeCcMails
        };
        postReq(url,data,function (result) {
            if(result.success) {
                $("#custserviceTable").bootstrapTable("refresh");
                $("#manageMailAddressModal").modal('hide') ;
                toastr['success']('操作成功', '提示');
            } else {
                toastr['error'](result.msg, '提示');
            }
        }) ;
    }
</script>